package com.lyh.demo.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.lyh.demo.api.DemoService;
import com.lyh.demo.api.entity.User;
import org.springframework.web.bind.annotation.*;

@RestController
public class demoController {

    @Reference(version = "1.0.0")
    DemoService demoService;


    @RequestMapping(value = "/user", method = RequestMethod.POST)
    public User user(@RequestBody User user) throws Exception {

        User user1= demoService.sayUser(user);
        return user1;

    }

    @RequestMapping(value = "/sayHello", method = RequestMethod.GET)
    public String sayHello(@RequestParam("str") String str) {

        return demoService.sayHello(str);

    }


    @RequestMapping(value = "/sayUser" )
    public User sayHello() throws Exception {

        return demoService.sayUser();

    }
}
